-
Notifications
You must be signed in to change notification settings - Fork 483
pytest based synthesis tests #1257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
merge hls4ml main into add-conftest
Add synthesis tests pytest
update add-conftest branch
Add conftest
test/pytest/conftest.py
Outdated
| "Vivado": {"csim": False, "synth": True, "export": False}, | ||
| "Vitis": {"csim": False, "synth": True, "export": False}, | ||
| "Quartus": {"synth": True, "fpgasynth": False}, | ||
| "oneAPI": {"build_type": "fpga_emu", "run": False}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fpga_emu is actually just C compilation, so this needs to be changed, though to what I am not sure. The descriptions are given in https://github.com/oneapi-src/oneAPI-samples/tree/release/2025.0/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/GettingStarted/fpga_compile#four-compilation-options and they correspond to fpga_emu, report, fpga_sim, and fpga. I would guess report unless you want to run cosim, in which case it's fpga_sim. The first two don't require Quartus, while the last two do.
|
Can we test this to actually run SYNTHESIS tests? |
|
yes, but if the env var 'RUN_SYNTHESIS' is not set, the default is False. |
Description
This PR introduces synthesis tests into the
pytestframework forhls4ml.The goal of this change is to automate the validation of HLS synthesis reports against predefined baselines to ensure stability and correctness over time, using pytest.
Main Changes
New submodule in
tests/pytestscalledbaselines, which is a Git submodule pointing to an external repository containing synthesis baselines.backend_tool/version/test_artifacts.jsonBaseline management:
New
conftest.pyfile to manage shared pytest fixtures:synthesis_configfixture, which provides:RUN_SYNTHESISenvironment variable).VIVADO_VERSION, defaulting to2023.1).model.build(...).Synthesis logic centralized in
synthesis_helpers.py:test_synthesis.RUN_SYNTHESIS=true, runs synthesis and compares the report to baseline.Tolerances for report values can be specified using
get_tolerance.CI integration:
ci-template.ymlupdated accordingly).Current test coverage:
test_keras_api.pyincludes synthesis tests at the moment.baseline_file_nameto the test,test_synthesis().OneAPI backend is currently skipped due to missing synthesis reports support.
Type of change
Tests
Synthesis tests are run conditionally and compared against versioned baselines if
RUN_SYNTHESIS=trueis set in the environment.Checklist
pre-commiton the files I edited or added.